11. Wrap an XHR

Wrap an XHR

1.10 Wrap an XHR Quiz

Instructions

First, if you haven't already, read this and follow the instructions on working with the Exoplanet Explorer repo.

  1. Checkout the xhr-start branch and navigate to app/scripts/app.js.
  2. Wrap the XHR in a Promise in the get() function. See XHR documentation for more information.
  3. Resolve on load and reject on error.
  4. If the XHR resolves, use addSearchHeader() to add the search header to the page.
  5. If the XHR fails, console.log() the error and pass 'unknown' to addSearchHeader().

Checkout xhr-solution to see my solution.

Solution

1.10 Wrap an XHR Solution